-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve forced subtitle handling #821
Conversation
I have tested this only on fixes/33, but no changes seem to have been made in that area between that and master. The rebase went cleanly without conflicts. |
141b577
to
135ca8f
Compare
Could this be related to #773 ? |
I don't believe so. It's a shame that #773 is specific to master: I've just been trawling through what must be code relevant to #773, but only the fixes/33 version (I don't run master and haven't found an easy way to test it). I will take a look at the fixes/33 vs master diffs and see if any changes stand out within the code I've recently had to understand. |
#773 seems to have started after a bunch of changes that were made this year, so it won't apply to fixes/33. |
After fixing #773, I tested this (without the pull request). Pressing T while forced subtitles are in effect displays a message that the forced subtitles are on or off but does not have any effect on their display. This is clearly a bug. The T switches between the menu items "Enable subtitles" and "Disable subtitles" while ignoring the menu item "Disable Forced Subtitles" IMHO, the T (toggle) should turn off the subtitles and turn them on again. That is useful. If you cannot hear something you turn them on, then once you are hearing the dialog better you turn them off. It does not make sense for T to switch between two sets of subtitles. What is the use case here? Two people who speak different languages fighting over the remote? |
Yes I agree: you want to be able to turn on subtitles when you mishear something. That's the great thing about mythfrontend having a simple toggle for on and off. But here is my thinking in chosing the behaviour of this new code. You want to be able to toggle the subtitles on and off ALL THE WAY THROUGH the video, but the forced ones are useless for this because usually they come into play at just a few points in time - when people are speaking in a language different to the video's default. That is almost always the case with forced subtitles: they are (in a way) off most of the time even when enabled because there just isn't any text in a forced subtitle track over most of a video. With my changes, you still see the forced subtitles without explicitly enabling (no change there), but you also still get to toggle on a subtitle track that has text for every word spoken in the video, so a feature useful thoughout the video. It makes videos with forced tracks behave very much like videos without forced tracks - so more conistent. If we updated this to toggle off and on the foced track (when present) then it would be a fairly useless feature: you don't usually need to turn off a forced track because it's usually not present for most of the video. Also, as is the case now, the presence of a forced track would lose you the ability to toggle on a entire-video useful subtitle. At least give it a try. :-) And, if you were worried that the user might want to disable all subtitles including the forced track, there is already a separate command for disabling the forced track. |
135ca8f
to
f26115f
Compare
I will wait a few days for the subtitle bug fix to settle down, then test this. If it works, I will ask for comments on the mailing list, in case anybody has a problem with it. If all is OK I will push it then. |
Thank you Peter |
I am holding back on this because of a long chain of emails about it. There seems to be some controversy. |
Yes, makes sense. Controversy and possibly confusion. At the very least it needs establishing that it is working correctly on master. |
c25f3e8
to
17d0137
Compare
What are your thoughts on where we should go with this? There haven't been many interested in discussing it. I've had some back and forth with Angela Schmid, which didn't go well, mainly - I believe - because I'd made a mistake resolving the conflicts with your recent changes (hopefully corrected now). In my last post I found a better way of describing the feature, but Angela didn't reply. Since then, both David Hampton and Paul Harrison have chipped in with support for the change (although, I don't get the impression they tested it). |
Please confirm that this is the final change that this pull request provides (from your email):
If this is correct, I will test in on master and if all works I will commit it. |
Thank you Peter. Yes, the pull request has the latest versions of my commits, and that's the intended behaviour. |
@bennettpeter What you wrote is the current behavior on master, with or without the pull request, and differs from what Paul intended with this pull request and it's behavior on v33. When you think I am wrong, please perform some scenarios once again, with and without the pull request, and explain the difference. The last week I didn't had time to respond on the current discussion in the mailing list, I will try to do this latest Sunday. I am concerned, that at one point, with future changes, the behavior of TOGGLECC changes. |
If playing a video without a forced subtitle, there is no difference with this pull request. Current master playing a video with forced foreign subtitles:
Current master with pull request playing a video with forced foreign subtitles:
|
With your tests, you had the global subtitle setting OFF. The behavior is different when ON.
From the start the English subtitle is selected in the menu. When you selected the subtitle via the menu, you have just pressed the already selected English subtitle. About using the TOGGLECC (definition: toggle subtitle ON/OFF), as with global setting OFF, their is way too much going on:
The Foreign Subtitles (forced) is selected in the menu. Disabling forced, only works when selecting both "Disable Subtitle" and "Disable Forced Subtitle" from the menu.
|
That's the old broken behaviour. I made a mistake in conflict resolution when moving this from fixes/33 to master. I've pushed corrections since our initial discussions. If you wish to test this, you need to pull the new version. All these recent discussions relate to the fixed version.
There have indirectly been some discussions of your proposal. I posted to mythtv-users describing 3 options. Option 2 was my attempt to describe your suggestion. Both David Hampton and Paul Harrison preferred Option 3 which is what this change achieves. My description may be wrong but, if so, it would be useful if you explained in what way. |
Actually, there could be an unintended dependence on the global setting. Let me check that. |
My suggestions do not have directly anything to do with your pull request. Instead of this, sorry for the wording, horrible intruding behavior of TOGGLECC, which makes it a very unexpected experience. It would also have been nice, when you would have reacted on my concern that it is too complicated. In my mailing list comments, I already wrote about unexpected behavior when further toggling and changing the subtitles (also in combination with the menu). I am just hoping the TOGGLECC behavior does not change, and commented several times to use another key. The pull request still uses TOGGLECC, so my concern is still valid.
When we only look on the global setting ON, nothing should need to change (in the sense of this pull request): One of my suggestions was to have an option to set the non-forced subtitle as default, this would make the pull request superfluous. Unfortunately, nobody commented on the two possible ways to solve. What I noticed yesterday was, that you have forced-pushed your changes, maybe you did a rebase. I cloned your repo and got the following:
The commit dates differ from the github commit dates. |
Your description of what I'm attempting to achieve is not what I'm attempting to achieve. In a way, I want the same as you, I believe: to fix some strange behaviour. Here is the strange behaviour (referring to mythtv without my changes): I play videos that have subtitles, and mishear something in the audio. I know that these videos have subtitles so I hit Left Arrow a few times and then T to replay a bit of the video with subtitles on. That sometimes works and sometimes doesn't. The reason that sometimes doesn't work is because the video has a forced track and it's been selected by mythtv as the default. The part of the video where I misheared something had no text in the forced track, so I see no subtitle text. I hate this. I get the impression you hate this too. The difference in our solutions, I believe, is that you wish to fix it by removing the automatic forced track feature entirely. I want to fix it while maintaining that feature. I very much like getting forced tracks automatically. I just don't want to get them at the expense of easy one key access to the main tracks. Does that help at least in understanding what I wish to achieve? |
In this pull request: There is a bug when "Always Display Closed Captioning or Subtitles" is selected. Playback starts with English subtitles. Pressing T disables them but does not enable the forced subtitle. There is another bug which shows whether or not the "Always Display" is selected. Using Menu->Subtitles->Select Subtitle->xxx (forced). causes the forced subtitle to be turned off, while reporting it is on. Pressing T turns the subtitle on while reporting it is off and pressing it again turns the subtitle off while reporting it is on. |
Yes, I've just noticed that too. I can see the problem. There are some functions regarding forced subtitles that are now unnecessary, but which I'd left in. I also don't like the way that I'm storing one selected forced subtitle rather than one per subtitle type. I think I should have made it more consistent with the storing of the main selected subtitle of each type.
Yeah, I was sort of aware of something like that, although I thought it was that - while the reporting toggled between on and off, the forced track remains active. It's a strange edge case because the selected and forced track are the same so you are toggling between a track and itself. I'm not sure what best to do about it. At least it's not a regression because its mythtv's current default behaviour when a forced track is present. It's aspect I haven't managed to fix so far. |
Not quite the same as current. I retested current master, and if I select the forced subtitle then use T it reports that it is on or off while all the time continuing to display it, regardless of whether it was reported as on or off. |
I thought it still did that with my changes - although probably only if the global setting is off. |
Yes. That's exactly right. We do seem to have a common understanding of what I was intending and why.
Yes, and that would be how it would work with my changes (if I could get them right, that is :-) ). Possibly the current version does do that
I'd dispute that you need that. If the toggle switched to forced rather than off, you'd likely not notice because the chances you'd still see subtitles are negligible. On the odd occasion that subtitles remained visible even though you've switched them off, since they come from the forced track, they'd likely be something you wouldn't understand from the audio. It would be a benefit that you haven't been able to turn them off. I see it as just honoring the meaning of the word "forced". On the other hand, I do see that the change isn't a clear win if you are a user that has the global setting on because the very annoying behaviour I'm fixing has never affected you.
Yes, by chance, I think the current version gives my intended behaviour when the global setting is off, and yours when it is on. Possibly we could go with that, but - as Peter pointed out - really it's a bug. I would expect the global setting On to behave just like having the setting Off, but hitting TOGGLECC immediately the video starts.
I disagree. There is some confusion due to the remaining bugs but, other than that, I think it's just a case of honoring the meaning of the word "forced" and not confusing.
Yes, fair enough, but I just haven't the interest to expand this into a more general rework of the subtitle system. The whole thing needs rewriting and it looks a big job. My take on this was that I had a fix for a really annoying behaviour. I've been using it in my own releases and package building. It's working well for me. Maybe it would be useful to others. I've only today become aware that the really annoying behaviour isn't apparent when the global setting is on. And although I have some sympathy for Klaas's view, I have no appetite for writing wiki pages. |
d8c9001
to
614be02
Compare
I've just pushed a new version with the bugs fixed.
|
Looking good, thanks for making a non-forced default. Also the menu is looking better. The following issues I found:
A wish: Compile give the following warning:
|
That's great that you are finding this to be working for you.
I too had wondered about that. It could be wasted work as I've never seen a video with more than one forced track in the wild, but it does make logical sense. I'll take a look how difficult it is to do.
Yes, I see what you mean. That shouldn't be hard to fix.
I think that would need discussion amongst the devs. There could be users of this interface which rely on its current behaviour. Does mythfrontend provide a way to map a key to a sequence of commands? I can't remember. If so that might be something you could use to get the behaviour you want.
Noted. |
One more commit added: as angelaschmid suggested, on changing the selection of the main subtitle, an attempt is made to update the corresponding forced track to the same language. I didn't do anything about inhibiting the Disable/Enable Forced Subtitle menu option when the main selection happens to be a forced track. Although it has no immediate effect in that case, someone might want to alter the option ready for a later change of selected main subtitle. I also noticed that mythfrontend displays this option even in the case that none of the available subtitles are forced. We can always come back to this at a later date. I didn't fix the warning either because it's not caused by the changes in this pull request, as far as I can tell. |
I am about to leave for holidays, I will have a look on Jan 8th. |
Someone else looks to have fixed that compile error. |
The commit "Attempt to match forced track language to that of the selected main track" works. With the pull request
In the mailing list I proposed to simplify things (e.g. reducing to have one menu subtitle toggle on/off, unfortunately nobody commented). I think the two on/off states and the toggle states collide and are difficult to handle with menu and key events, and expose them unambiguous back to the menu. Do you want to fix this in this pull request? <style> </style>
Would this also be your expected behavior? |
Yes, yet another bug, sorrry. Thank you for reporting it.
Yes, that's it. It's another edge case I missed. I've fixed it now and will push the corrected version soon.
Ah, but this is intended. That behaviour is as expected and is the whole point of these changes: the automatic display of forced subtitles is achieved without loosing track of the user's track selection. It has to be so, otherwise there would be no way to know which track to toggle back to. Not being able to toggle back is the problem I am fixing.
No it shouldn't. The forced subtitle is being shown via the forcing mechanism and not by being selected. The menu shows the user's original choice of subtitle because that is what is still selected in the state. Because of my changes the forcing mechanism doesn't need to mess around with the users choice.
Yes, I agree that things are a little confusing when the user explcitly chooses a forced subtitle as their main subtitle choice. This does at least now work as Peter requested. Later we might consider removing the forced subtitles from the list so that this confusing state cannot be reached. We could have a second list of forced subtitles. But it's good enough at it is. Because of the forcing mechanism, users never need to explicitly choose the forced subtitle (they will see it automatically when subtitles are off via the forcing mechanism).
Yes. A user selection now performs two operations. It sets the current main subtitle to the one the user chooses, and it also searches for a language matching forced subtitle and stores that for use when forcing.
The former. I do not put any code in the way of the user's control of these states. All my changes are to do with how those states behave.
That has been discussed. There are attractions in the simplicity, but it means losing the secondary forcing mechanism for forced subtitles. It would make it impossible to toggle with a single button press between the two most useful states, those being "Having the movie showing you subtitles for the cases where it's been decided the user will very likely need them" and "Displaying the subtitle track the user has chosen to explicitly enable." The two toggles are absolutely necessary because there are two mechanisms via which subtitles are displayed: via forcing and via user selection. There is no problem reflecting the states in the menus. It's just looks that way because of confusion due partly because of bugs and partly if not understanding that forcing is a separate mechanism that doesn't involve updating the user's selection.
I've lost track of exactly what this is referring to. I think probably no. I've hoping that the bug fix I'm about to push is will be the end of it. <style> </style> Sorry, I'm finding that very difficult to follow. I'm not even quite sure what the Having column is. One thing to be aware of is that the intention is that the user never needs to explicitly select a forced subtitle. The interface is allowing that, but it's not really a useful state. |
51c449c
to
410f823
Compare
Also generalise the algorithm to allow forced tracks to be disfavored. This is work towards improving the handling of forced tracks.
This improves the behaviour of mythfrontend in its automatic handling of forced subtitle tracks. The previous behaviour relied on automatically selecting the forced track as a default for the user's preference. The new behaviour attempts to find a non-forced track for the user's preference and changes the subtitle toggle feature to be between forced and non-forced, rather than on and off.
Recent changes to the handling of forced AV subtitle tracks require that two tracks may be considered for processing simultaneously. This happens if there is a forced track and a user enabled one. This commit ensures that the user enabled one inhibits the forced one.
The effect of this condition was to inhibit selection of a forced track if the global setting "Always Display Subtitles" was on. Doing so is not desirable, and is no longer necessary, since the new way of handling forced tracks doesn't interact unfavorably with full tracks.
…rack By default, TOGGLECC toggles between displaying the user's selected track and the forced track (if present). If the user selects a forced track, that behaviour can make TOGGLECC look like it does nothing. This commit special cases that scenario, allowing TOGGLECC to toggle between on and off for the user selected track.
410f823
to
7a4fecf
Compare
The new version that I recently pushed fixes the problem that led to explcit selection and enabling of a forced subtitle not always causing that subtitle to be shown. Here is a table showing the intended behaviour - what I see when I test, irrespective of how I get to these states:
The user also has the option to disable forced subtitles in which case the behaviour (differing only in the 3rd column of the 2nd line) is:
|
I haven't looked into your updated pull request, but commenting on your last two comments. In my last check I noticed that with multiple languages and accessing the menu the results are unpredictable. Also it needs multiple different presses to come again into a desired mode. The OSD does not tell the truth; have seen cases were it says ON, but actually nothing was shown.
I am referring to simplifying the subtitle menu and coming into a code state were the mentioned unexpected behaviors are solvable. Subtitle menu selections should address your "to toggle with a single button press between the two most useful states". I don't see that this wouldn't be possible, after removing one of the two subtitle ON/OFF toggles, because that is interfering with your logic. |
In your last check, yes. That was the bug. It was unpredictable, I know exactly why and I have fixed the problem.
Other than the possibility of remaining bugs, which of course I cannot guarantee, there are now no unexpected behaviours (unexpected to me at least). The only behaviour that some might consider unexpected is having English (say) selected, having subtitles Off and seeing English (forced) subtitles displayed, but that is the whole intent in supporting forcing of subtitles.
That is possible, but some users may at times wish to have no subtitles displayed at all (even the forced ones). Without the "Forced subtitle On/Off" toggle, there would be no way for a user to choose that behaviour. Another way to explain it is that the "Forced subtitle On/Off" toggle allows the user to choose between the two tables I present in my previous comment. I realise the multiple bugs in earlier versions have made testing this difficult, but the tables I show above have always been the intended behaviour. It has just taken some time to get there. |
I thought we had at one point the consensus to always at minimum show forced subtitles. This would have simplified interactions, by removing one of the on/off toggles, and making behavior predictable/understandable. Giving that you want to keep "disable forced subtitle", I tested current master and your updated pull request. It is working fine, up till a forced subtitle is selected, as it behaves as a non-forced subtitle. OSD information is incorrect and the menu toggles states are incorrect and behave unexpected. As mentioned before, I have seen the OSD informs ON, no subtitle is shown. As you have implemented a swap mechanism, the forced/non-forced subtitle on/off logic and the selection of forced/non-forced subtitles would need to be projected into the "swap state". |
The option to turn off forced subtitles predates my changes. My preference is to keep that option, but I'm not against removing it if the devs okayed doing so. It's a little difficult to talk about "consensus" when it is just you and I discussing it.
Once implemented correctly, the cases with forced subtitles toggled off should be the simplest and easiest to understand: the behaviour should be:
Thank you for testing yet again. Your efforts are much appreciated.
Gah! Really?! I definitely found one cause of that. I fixed it. I tested. There is the problem that I am testing fixes-33 and then taking my changes over to master without being able to test on master. I may have to shelve this until the next release, when I'll be able to work on a fixes branch that's very close to master, at least for a while. I will test again. Please say if you can recall a particular sequence of commands that gave rise to one of these states, particularly the ON with nothing showing case - although anything not matching the tables I posted a few comments back would be useful.
The two tables from a few comments back should explain at least the intention in how those settings project to the swap state. A problem with the swap mechanism is that the user can select as their main subtitle the same track as the forced track. In that case swapping (unless special cased) does nothing because the two things swapped between are the same. That would lead to TOGGLECC showing a message reporting toggling of the on/off state, but the same subtitle is displayed: it would be displayed in the on state because it is selected and it would be displayed in the off state because it is forced. To avoid that weirdness, I turn off forcing when a user selects a forced subtitle. That way they should see the subtitle only in the on state. That special casing was added to address one of Peter's comments. |
I've tested the fixes-33 version again and haven't been able to provoke any incorrect behaviour. I've also closely checked the match between the changes on fixes-32 and those on master and I can't see any differences. The unchanged code of fixes-33 and master differ to some degree in SubtitleReader::AddAVSubtitle, which is one of the methods altered, but the code changes look to have been made appropriately to account for that. One test is to use NEXTSUBTITLE to step through each subtitle one by one with subtitles enabled. I see, as expected:
With subtitles disabled, I see:
That again is exactly as intended. If you are seeing different results, I have no explanation. |
If you have external subtitles (srt file), the forced subtitles do not show, in fact no subtitles show until you enable them. With the setting "Always display subtitles", the English subtitles start when play starts, and toggling turns them off. The forced subtitles do not show unless you specifically enable them. Both of these behaviours were this way before your pull request. They are not entirely logical. They are outside the scope of this pull request. They can be fixed later if needed. |
I have merged the commits into master |
I tried some two weeks ago with an updated master and the pull request.
I could not reproduce this one. I thought I could easily reproduce it and I do not have an explanation that I couldn't anymore, as the source hasn't changed. Peter was just half a day earlier with merging into master. I earliest had time today. Tested with merged master and only used keys: Global subtitles ON TOGGLECC: 'Subtitle 4: German "German" Off' -> german forced NEXTSUBTITLE: 'Subtitle 5: French "French"' (no On/Off shown) -> french forced, expected would be to show french non-forced NEXTSUBTITLE: 'Subtitle 6: French "French forced" (forced)' (no On/Off shown) -> no subtitle shown, expected would be to show french forced NEXTSUBTITLE: 'Subtitle 1: Englisch "English forced" (forced)' (no On/Off shown) -> no subtitle shown, expected would be to show french forced NEXTSUBTITLE: 'Subtitle 2: English"' (no On/Off shown) -> english forced, expected would be to show english non-forced TOGGLECC: 'Subtitle 2: English" On' -> english non-forced TOGGLECC: 'Subtitle 2: English" Off' -> english forced Would be nice NEXTSUBTITLE enables the subtitle (forced or non-forced), and in the OSD it shows explicitly "On". |
Peter - thanks for getting that in. Angela - those results are exactly as currently intended, but I clearly understand your reasoning for expecting otherwise. You have identified the distinction is whether NEXTSUBTITLE should just update the selection or whether it should also put subtitles into the enabled state. That's not something I have an opinion on and didn't wish to change it in this pull request. We'd need devs-wide agreement for that. I do intend to make further improvements, but not until after the next mythtv release. |
Change mythfrontend's auotmatic handling of forced subtitles so as to avoid making selection of non-forced subtitles less convenient.
This fixes Issue #820.
The previous implementation handled forced subtitle tracks by making a forced track the user's default selection. Because of that, the user was not able to toggle on a suitable non-forced track simply by using the T key. Also, should the user select a non-forced track then the handling of the forced track became inhibited.
This new implemenation stores the forced track without making it the user's default selection, so that the T key will toggle between the non-forced and forced track, rather than between on and off.
Checklist